package org.example.leetCode;

/**
 * @Author Qinkai
 * @Description TODO $
 * @Date $ 2021-09-23$
 * @Param $
 * @return $
 **/
public class IsPowerOfThree {
    public boolean isPowerOfThree(int n) {
        if (n == 1) {
            return true;
        }
        if (n == 0) {
            return false;
        }
        return (n % 3 == 0) && isPowerOfThree(n / 3);
    }
}
